﻿using FastEndpoints;
using FluentValidation;
using vite_entity.Entities;

namespace vite_net.Controllers.User.GetUserList;

sealed class Model
{
    public sealed class Request
    {
        public int page { get; set; }
        public int limit { get; set; }
        public string? startDate { get; set; }
        public string? endDate { get; set; }
        public string? name { get; set; }
        public string? userNumber { get; set; }
        public string? deptId { get; set; }

        internal sealed class DictValidator : Validator<Request>
        {
           
        }
    }

    public sealed class Response
    {
        public int Total { get; set; }
        public List<User> Data { get; set; } = new List<User>();
        public class User {
            public long Id { get; set; }
            public string? Avatar { get; set; }
            public string? CreateTime { get; set; }
            public string? DeptCode { get; set; }
            public string? DeptName { get; set; }
            public string? Email { get; set; }
            public int? GenderKey { get; set; }
            public string? GenderLabel { get; set; }
            public string? Mobile { get; set; }
            public string? NickName { get; set; }
            public List<string> RoleCodes { get; set; } = new List<string>();
            public string? RoleNames { get; set; }
            public int Status { get; set; }
            public string? UserName { get; set; }
        }
    }



    internal sealed class Mapper : Mapper<Request, Response, SysUser>
    {
        //public override Response FromEntity(SysUser e) => new()
        //{
        //    Id = e.Id,
        //    FullName = e.FullName,
        //    UserName = $"USR{e.Id:0000000000}",
        //    Age = (DateOnly.FromDateTime(DateTime.UtcNow).DayNumber - e.DateOfBirth.DayNumber) / 365,
        //};
    }

}
